import { modal } from 'vue-strap'
import { showMsg, exportCodeResource } from '../../../../vuex/action'

export default {
  name: 'code-excel',
  data() {
    return {
      title: '导出兑换码',
      count: ''
    }
  },
  props: ['showExport', 'prizeId'],
  components: {
    'vue-modal': modal
  },
  vuex: {
    actions: {
      xShowMsg: showMsg
    }
  },
  methods: {
    showImportExcel() {
      this.showExport = true
    },
    submit() {
      if ((this.count + '').length === 0) {
        this.xShowMsg({
          type: 'danger',
          content: '* 标记的均为必填/必选项'
        })
      } else {
        this.showExport = false
        location.href = exportCodeResource + '?prizeId=' + this.prizeId + '&count=' + this.count
        setTimeout(() => {
          location.reload()
        }, 2000)
      }
    }
  }
}
